#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "pdu.h"
#include "atcmd.h" 
#include "type.h"

//char pdu[] = "0891683110808805F0240BA13176002464F30008515040917023230400205510";
//char pdu[] = "0891683110808805F0240BA13176002464F300085150708173722306551094ED806A";
//char pdu[] = "0891683110808805F0240BA13176002464F3000851507081936523025510";
//char pdu[] = "0891683110808805F0640BA13176002464F30008515050019435238C05000318050165878A00662F4EE553E46C498BED4E3A57FA78407ECF8FC752A05DE576844E6697628BED3C";
char pdu[] = "0891683110808805F0000BA18105036714F30008514071903511238C67094EBA51654FB58B6660C5FF1A51859632533A7EA259164EBA4F534F20611F566862A58B66000D000A0D";
int main ( int argc, char *argv[] )
{    
    int ret = -1;
    int smsindex = -1;
    RECVPDU_STRU recv;

    
#if 1    
    ret = sim800l_serial_init(115200);
    if ( ret < 0 )
    {
        printf("init seial port error\n");
        return -1;
    }
    
    //sim800l_send_sms(EN_TEXT, "13670042463", argv[1]);
    //sim800l_send_sms(EN_PDU, "13670042463", argv[1]);
    while (1)
    {
        smsindex = sim800l_listen_sms();
        printf("smsindex:%d\n",smsindex);
        memset(&recv, 0x0, sizeof(recv));
        ret = sim800l_get_sms(smsindex, &recv);
        printf("ret:%d\n",ret);
    }
    
    sim800l_close();
#else
    parser_pdu( pdu, &recv);
#endif
    return 0;
} 
